import random
from zhipuai import ZhipuAI

api_key = "4956db3da95d43eab77efa6937882679.Xm27NhBWZPJE3ORb"
client = ZhipuAI(api_key=api_key)


def print_multi():
       for i in range(1,10):
            for j in range(1,i+1):
                print(f"{j}*{i}={i*j}",end="\t")
            print()

# print_multi()

content="""
def print_multi():
    for i in range(1, 10):  # 控制行数，从1到9
        for j in range(1, i+1):  # 控制每行的列数，从1到i
            print(f"{j}x{i}={i j}", end="\t")  # 打印乘法表达式，使用\t进行分隔
        print()  # 每完成一行的输出后换行
"""
# messages = [{"role":"user","content":"现有函数如下:%s,请问该函数是否有何问题，该如何修改"  % content}]
# response = client.chat.completions.create(model="glm-4",messages=messages)
# print(response.choices[0].message.content)

with open(r"F:\ai\03大模型开发实战\08 低代码智能开发平台案例实践\error_function_test\get_latest_email.py", "r", encoding="utf8") as f:
    error_code = f.read()

messages = [{"role":"user","content":"现有函数如下:%s,请问该函数是否有何问题，该如何修改" % error_code}]
response_code = client.chat.completions.create(model="glm-4",messages=messages)
print(response_code.choices[0].message.content)

